fix: give each basis independent ell_comps in mge_model_from#342
Merged
fix: give each basis independent ell_comps in mge_model_from#342
Conversation
Previously, centre and ell_comps priors were constructed once outside the per-basis loop, so gaussian_per_basis > 1 added redundant Gaussians with zero extra flexibility (always 4 free params regardless of basis count). Now ell_comps are always independent per basis, and a new centre_per_basis flag optionally gives each basis its own centre priors. Existing calls with gaussian_per_basis=1 produce identical output. Calls with gaussian_per_basis>1 now get the intended extra flexibility (e.g. 6 free params for 2 bases). Closes #341 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mge_model_fromconstructed centre and ell_comps priors once outside the per-basis loop, sogaussian_per_basis > 1added redundant Gaussians with zero extra flexibility (always 4 free params). Now each basis gets independent ell_comps, and a newcentre_per_basisflag optionally gives each basis its own centre priors.Closes #341
API Changes
centre_per_basis: bool = Falseonmge_model_from— when True, each basis gets independent centre priorsmge_model_fromwithgaussian_per_basis > 1now produces independent ell_comps per basis (was previously tied). Calls withgaussian_per_basis=1are unchanged.See full details below.
Test Plan
Full API Changes (for automation & release notes)
Added
mge_model_from(..., centre_per_basis: bool = False)— new keyword argument. When True, each basis gets independently drawn centre priors instead of sharing one set.Changed Behaviour
mge_model_fromwithgaussian_per_basis > 1: ell_comps are now independent per basis. Previously all bases shared the same ell_comps prior instances, giving 4 free params regardless of basis count. Now gives2 + 2Kfree params for K bases (shared centre) or4K(withcentre_per_basis=True).gaussian_per_basis=1(backward compatible).Migration
mge_model_from(mask_radius=3.0, gaussian_per_basis=2)→ 4 free params (bug)mge_model_from(mask_radius=3.0, gaussian_per_basis=2)→ 6 free params (intended)mge_model_from(mask_radius=3.0, gaussian_per_basis=2, centre_per_basis=True)→ 8 free params🤖 Generated with Claude Code